package org.jeecg.modules.deepseek.pojo;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import org.springframework.ai.openai.api.OpenAiApi;
import org.springframework.ai.openai.api.ResponseFormat;

import java.util.HashMap;
import java.util.List;

@Data
public class ChatRequest {
    private String model;
    private List<Message> messages;
    List<OpenAiApi.FunctionTool> tools;
    private String toolChoice;
    private ResponseFormat response_format;

    private boolean stream = false;

    @Data
    public static class Message {
        private String role;
        private String content;
        @JsonInclude(JsonInclude.Include.NON_EMPTY)
        List<OpenAiApi.ChatCompletionMessage.ToolCall> tool_calls;
        @JsonInclude(JsonInclude.Include.NON_EMPTY)
        private String tool_call_id;
        public Message() {
        }

        public Message(String user, String s) {
            this.role = user;
            this.content = s;
        }

        public Message(String user, String content, List<OpenAiApi.ChatCompletionMessage.ToolCall> tools) {
            this.role = user;
            this.content = content;
            this.tool_calls = tools;
        }

        public Message(String assistant, String content, String tool_call_id) {
            this.role = assistant;
            this.content = content;
            this.tool_call_id = tool_call_id;
        }


        public Message(String assistant, List<OpenAiApi.ChatCompletionMessage.ToolCall> toolCalls) {
            this.role = assistant;
            this.tool_calls = toolCalls;
        }
    }

    @Data
    public static class Tool {
        private String type;
        private Function function;

        @Data
        public static class Function {
            private String name;
            private String description;
            private Parameters parameters;

            @Data
            public static class Parameters {
                private String type;
                HashMap<String, Properties> properties;
                private String[] required;


            }
        }
        @Data
        public static class Properties {
            String  type;

            String  description;

        }
    }
}


